#include "StdAfx.h"
#include "ScramblerFactory.h"
#include "SgTranslate.h"
#include "sgcomposite.h"
#include "SgRotate.h"
#include "sgrotatearoundpoint.h"
#include "sgptr.h"
#include "sgseparator.h"
#include "sgcylinder.h"
#include "sgoctagonalcylinder.h"
#include "SgTexture.h"
#include <cmath>

ScramblerFactory::ScramblerFactory(void)
{
	m_Scrambler = new CSgComposite();
	m_TexCenter= new CTexture();
	m_texArms = new CTexture();
	m_texSeats = new CTexture();
	m_rotateOffset = 0;
	m_counter = 0;

	m_TexCenter->LoadFile(L"orange.bmp");
//	TexSeperators.LoadFile("orange.bmp");
	m_texArms->LoadFile("metalicBlue.bmp");
//	TexPoles.LoadFile("orange.bmp");
	m_texSeats->LoadFile("silver.bmp");
}

ScramblerFactory::~ScramblerFactory(void)
{
}

void ScramblerFactory::AdvanceTime(const DWORD & timeDiff, const DWORD & currentTime)
{
	float temp = (currentTime/1000)%26;
	float temp2 = fmod((currentTime/1000.),26);
	float degInc = 0;
	int value = 3*(int)((float)timeDiff / 30.) % 360;

	//starting takes 5sec
	if(temp < 5)
	{
		degInc = (int)(value - value*(1.0-temp2/5));	
		if(degInc > value)
			degInc = value;
	}
	//normal movement takes 14sec
	else if(temp < 18)
	{
		degInc =  value;
	}
	//stopping for 5sec
	else if(temp < 23)
	{

		degInc = (int)(value - value*(temp2/23));	
		if(degInc < 0)
			degInc = 0;
	}
	//else stopped for 3 sec
	m_rotateOffset = (int)(m_rotateOffset+degInc)%360;

	m_rotateAroundC->SetDegrees(m_rotateOffset);
	for(int i = 0; i < 3; i++)
		m_rotateAroundO[i]->SetDegrees(m_rotateOffset);
}

CSgObject* ScramblerFactory::Create()
{
	m_Scrambler->RemoveChildren();
	//creates the center and attaches everything to it
	CreateCenter();

	return m_Scrambler;
}


//Creates the center posts
void ScramblerFactory::CreateCenter()
{
	CSgPtr<CSgComposite> center = new CSgComposite();
	CSgPtr<CSgMaterial> matY = new CSgMaterial(50.f, 0.698039216f, 0.133333333f, 0.133333333f, 1.0f, 0.698039216f, 0.133333333f, 0.133333333f, 1.0f);

	CSgPtr<CSgCylinder> smallCyl = new CSgCylinder(.33, 1.);
	matY->SetChild(smallCyl);
	center->AddChild(matY);
	CSgPtr<CSgSeparator> seperator1 = new CSgSeparator();
	CSgPtr<CSgTranslate> translate1 = new CSgTranslate(0., .5, 0.);

	translate1->SetChild(matY);
	seperator1->SetChild(translate1);
	center->AddChild(seperator1);

	CSgPtr<CSgCylinder>  largeCyl= new CSgCylinder(3, .5);
	//largeCyl->SetTexture(*TexCenter);
	CSgPtr<CSgSeparator> seperator2 = new CSgSeparator();
	CSgPtr<CSgTranslate> translate2 = new CSgTranslate(0., .83, 0.);

	translate2->SetChild(largeCyl);
	seperator2->SetChild(translate2);
	center->AddChild(seperator2);


	
	//Create top and bottom arms
	CSgPtr<CSgComposite> Arms1= CreateArms();
	center->AddChild(Arms1);

	CSgPtr<CSgComposite> Arms2= CreateArms();
	CSgPtr<CSgSeparator> seperatorL2 = new CSgSeparator();
	CSgPtr<CSgRotate> rotateL2 = new CSgRotate(120.,0.,1. ,0.);

	rotateL2->SetChild(Arms2);
	seperatorL2->SetChild(rotateL2);
	center->AddChild(seperatorL2);

	CSgPtr<CSgComposite> Arms3=CreateArms();
	CSgPtr<CSgSeparator> seperatorU3 = new CSgSeparator();
	CSgPtr<CSgRotate> rotateU3 = new CSgRotate(240.,0.,1. ,0.);

	rotateU3->SetChild(Arms3);
	seperatorU3->SetChild(rotateU3);
	center->AddChild(seperatorU3);

	//arm fill in 
	CSgPtr<CSgComposite> triangle= Arm(.1, 0.866, 1., 0., m_texArms);

	CSgPtr<CSgSeparator> seperatorT = new CSgSeparator();
	CSgPtr<CSgTranslate> translateT = new CSgTranslate(.5, 3.95, 0.275);
	CSgPtr<CSgRotate> rotateT = new CSgRotate(180, 0,1,0);

	rotateT->SetChild(triangle);
	translateT->SetChild(rotateT);
	seperatorT->SetChild(translateT);
	center->AddChild(seperatorT);


	//attach outside pieces and animate
	CSgPtr<CSgComposite> outside1= CreateOutSide();
	center->AddChild(outside1);

	CSgPtr<CSgComposite> outside2= CreateOutSide();
	CSgPtr<CSgSeparator> seperatorO2 = new CSgSeparator();
	CSgPtr<CSgRotate> rotateO2 = new CSgRotate(120.,0.,1. ,0.);

	rotateO2->SetChild(outside2);
	seperatorO2->SetChild(rotateO2);
	center->AddChild(seperatorO2);

	CSgPtr<CSgComposite> outside3= CreateOutSide();
	CSgPtr<CSgSeparator> seperatorO3 = new CSgSeparator();
	CSgPtr<CSgRotate> rotateO3 = new CSgRotate(240.,0.,1. ,0.);

	rotateO3->SetChild(outside3);
	seperatorO3->SetChild(rotateO3);
	center->AddChild(seperatorO3);
	

	//Animation Rotation for center
	CSgPtr<CSgRotateAroundPoint> rotateAnim = new CSgRotateAroundPoint(m_rotateOffset,0,0,0,0,1,0);
	m_rotateAroundC = rotateAnim;
	rotateAnim->SetChild(center);

	m_Scrambler->AddChild(rotateAnim);
}

CSgPtr<CSgComposite> ScramblerFactory::Arm(double ht, double l, double w1, double w2,CTexture *tex)
{
	CSgPtr<CSgComposite> arm = new CSgComposite();
	CSgPtr<CSgTexture> textureT = new CSgTexture(tex);
	CSgPtr<CSgTexture> textureB = new CSgTexture(tex);
	CSgPtr<CSgTexture> textureL = new CSgTexture(tex);
	CSgPtr<CSgTexture> textureR = new CSgTexture(tex);
	CSgPtr<CSgTexture> textureI = new CSgTexture(tex);
	CSgPtr<CSgTexture> textureO = new CSgTexture(tex);

	//Points for an arm of 
	//length l
	//width w1 inside
	//width w2 outside
	double w2centered = (w1-w2)/2;
	double w2_1 = w2centered;		//centered outside width 1
	double w2_2 = w2+w2centered;	//centered outside width 2
	GLdouble a[] = {0., 0.,0.};
	GLdouble b[] = {w1, 0.,0.};
	GLdouble c[] = {w2_2,0.,l};
	GLdouble d[] = {w2_1,0.,l};
	GLdouble e[] = {0., ht,0.};
	GLdouble f[] = {w1, ht,0.};
	GLdouble g[] = {w2_2,ht,l};
	GLdouble h[] = {w2_1,ht,l};


	//Top
	CSgPtr<CSgPolygon> top = new CSgPolygon();
	top->AddNormal(CGrVector(0, 1, 0));
	top->AddTexCoord(CGrVector(0, 0));
	top->AddVertex(CGrVector(e));
	top->AddTexCoord(CGrVector(0, 1));
	top->AddVertex(CGrVector(h));
	top->AddTexCoord(CGrVector(1, 0));
	top->AddVertex(CGrVector(g));
	top->AddTexCoord(CGrVector(1, 1));
	top->AddVertex(CGrVector(f));
	textureT->SetChild(top);
	arm->AddChild(textureT);	

	//bottom
	CSgPtr<CSgPolygon> bottom = new CSgPolygon();
	bottom->AddNormal(CGrVector(0, -1, 0));
	bottom->AddTexCoord(CGrVector(1, 1));
	bottom->AddVertex(CGrVector(a));
	bottom->AddTexCoord(CGrVector(0, 0));
	bottom->AddVertex(CGrVector(b));
	bottom->AddTexCoord(CGrVector(0, 1));
	bottom->AddVertex(CGrVector(c));
	bottom->AddTexCoord(CGrVector(1, 0));
	bottom->AddVertex(CGrVector(d));
	textureB->SetChild(bottom);
	arm->AddChild(textureB);	

	//inside
	CSgPtr<CSgPolygon> inside = new CSgPolygon();
	inside->AddNormal(CGrVector(0, 0, -1));
	inside->AddTexCoord(CGrVector(1, 0));
	inside->AddVertex(CGrVector(a));
	inside->AddTexCoord(CGrVector(1, 1));
	inside->AddVertex(CGrVector(e));
	inside->AddTexCoord(CGrVector(0, 0));
	inside->AddVertex(CGrVector(f));
	inside->AddTexCoord(CGrVector(0, 1));
	inside->AddVertex(CGrVector(b));
	textureI->SetChild(inside);
	arm->AddChild(textureI);	

	//outside
	CSgPtr<CSgPolygon> outside = new CSgPolygon();
	outside->AddNormal(CGrVector(0, 0, 1));
	outside->AddTexCoord(CGrVector(0, 1));
	outside->AddVertex(CGrVector(c));
	outside->AddTexCoord(CGrVector(1, 0));
	outside->AddVertex(CGrVector(g));
	outside->AddTexCoord(CGrVector(1, 1));
	outside->AddVertex(CGrVector(h));
	outside->AddTexCoord(CGrVector(0, 0));
	outside->AddVertex(CGrVector(d));
	arm->AddChild(textureO);	

	//left
	CSgPtr<CSgPolygon> left = new CSgPolygon();
	left->AddNormal(CGrVector(-1, 0, 0));
	left->AddTexCoord(CGrVector(0, 0));
	left->AddVertex(CGrVector(a));
	left->AddTexCoord(CGrVector(0, 1));
	left->AddVertex(CGrVector(d));
	left->AddTexCoord(CGrVector(1, 0));
	left->AddVertex(CGrVector(h));
	left->AddTexCoord(CGrVector(1, 1));
	left->AddVertex(CGrVector(e));
	textureL->SetChild(left);
	arm->AddChild(textureL);	

	//right
	CSgPtr<CSgPolygon> right = new CSgPolygon();
	right->AddNormal(CGrVector(1, 0, 0));
	right->AddTexCoord(CGrVector(1, 1));
	right->AddVertex(CGrVector(b));
	right->AddTexCoord(CGrVector(0, 0));
	right->AddVertex(CGrVector(f));
	right->AddTexCoord(CGrVector(0, 1));
	right->AddVertex(CGrVector(g));
	right->AddTexCoord(CGrVector(1, 0));
	right->AddVertex(CGrVector(c));
	textureR->SetChild(right);
	arm->AddChild(textureR);	

	return arm;
}

//bottom arm connecting to outside
CSgPtr<CSgComposite> ScramblerFactory::CreateArms()
{
	CSgPtr<CSgComposite> comp = new CSgComposite();
	CSgPtr<CSgComposite> lowerArm = Arm(.17,5.,1,.5, m_texArms);

	CSgPtr<CSgSeparator> seperator = new CSgSeparator();
	CSgPtr<CSgTranslate> translate = new CSgTranslate(-.5, .33, 0.25);

	translate->SetChild(lowerArm);
	seperator->SetChild(translate);

	comp->AddChild(seperator);

	CSgPtr<CSgComposite> upperArm = Arm(.1,5.,1,.5,m_texArms);

	CSgPtr<CSgSeparator> seperator1 = new CSgSeparator();
	CSgPtr<CSgTranslate> translate1 = new CSgTranslate(-.5, 3.95, 0.25);

	translate1->SetChild(upperArm);
	seperator1->SetChild(translate1);

	comp->AddChild(seperator1);
	return comp;
}

CSgPtr<CSgComposite> ScramblerFactory::CreateOutSide()
{
	CSgPtr<CSgComposite> comp = new CSgComposite();
	CSgPtr<CSgComposite> center = new CSgComposite();

	//Bottom spinning pole
	CSgPtr<CSgCylinder> bottomCyl = new CSgCylinder(1.3, 0.1);
	CSgPtr<CSgSeparator> seperator = new CSgSeparator();
	CSgPtr<CSgTranslate> translate = new CSgTranslate(0., .1, 0.);
	translate->SetChild(bottomCyl);
	seperator->SetChild(translate);
	center->AddChild(seperator);

	//Block seperators
	CSgPtr<CSgComposite> box1 = Arm(.1,.25,.25,.25,m_texArms);
		
	CSgPtr<CSgSeparator> seperatorB1 = new CSgSeparator();
	CSgPtr<CSgTranslate> translateB1 = new CSgTranslate(-0.125, 1.4, -.125);
	
	translateB1->SetChild(box1);
	seperatorB1->SetChild(translateB1);
	center->AddChild(seperatorB1);

	CSgPtr<CSgComposite> box2 = Arm(.1,.5,.5,.5,m_texArms);
		
	CSgPtr<CSgSeparator> seperatorB2 = new CSgSeparator();
	CSgPtr<CSgTranslate> translateB2 = new CSgTranslate(-0.25, 0., -0.25);


	translateB2->SetChild(box2);
	seperatorB2->SetChild(translateB2);
	center->AddChild(seperatorB2);

	//Top possibly stationary pole
	CSgPtr<CSgCylinder>  topCyl= new CSgCylinder(1.83, .05);
	CSgPtr<CSgSeparator> seperator2 = new CSgSeparator();
	CSgPtr<CSgTranslate> translate2 = new CSgTranslate(0., 1.5, 0.);

	translate2->SetChild(topCyl);
	seperator2->SetChild(translate2);
	center->AddChild(seperator2);

	//Add Seat Connections
	CSgPtr<CSgComposite> connection1= CreateSeatConnect();
	center->AddChild(connection1);

	CSgPtr<CSgComposite> connection2= CreateSeatConnect();
	CSgPtr<CSgSeparator> seperatorC2 = new CSgSeparator();
	CSgPtr<CSgRotate> rotateC2 = new CSgRotate(90.,0.,1. ,0.);

	rotateC2->SetChild(connection2);
	seperatorC2->SetChild(rotateC2);
	center->AddChild(seperatorC2);

	CSgPtr<CSgComposite> connection3= CreateSeatConnect();
	CSgPtr<CSgSeparator> seperatorC3 = new CSgSeparator();
	CSgPtr<CSgRotate> rotateC3 = new CSgRotate(180.,0.,1. ,0.);

	rotateC3->SetChild(connection3);
	seperatorC3->SetChild(rotateC3);
	center->AddChild(seperatorC3);

	CSgPtr<CSgComposite> connection4= CreateSeatConnect();
	CSgPtr<CSgSeparator> seperatorC4 = new CSgSeparator();
	CSgPtr<CSgRotate> rotateC4 = new CSgRotate(270.,0.,1. ,0.);

	rotateC4->SetChild(connection4);
	seperatorC4->SetChild(rotateC4);
	center->AddChild(seperatorC4);

	//Translate the whole outside
	CSgPtr<CSgSeparator> seperator3 = new CSgSeparator();
	CSgPtr<CSgTranslate> translate3 = new CSgTranslate(0., 0.5, 4.95);
	CSgPtr<CSgRotateAroundPoint> outAnim = new CSgRotateAroundPoint(m_rotateOffset,0,0,0,0,1,0);
	m_rotateAroundO[m_counter]= outAnim;
	m_counter++;
	
	outAnim->SetChild(center);
	translate3->SetChild(outAnim);
	seperator3->SetChild(translate3);

	comp->AddChild(translate3);
	return comp;

}

CSgPtr<CSgComposite> ScramblerFactory::CreateSeatConnect()
{
	CSgPtr<CSgMaterial> baseMmat = new CSgMaterial(50.0f, 0.1255f, 0.753f, 0.251f, 1.0f, 0.1255f, 0.753f, 0.251f, 1.0f);
	CSgPtr<CSgComposite> connection= new CSgComposite();

	// small arm and 3 octoganalcyiliders to connect the seats to the body
	CSgPtr<CSgComposite> lowerArm = Arm(.1,2.,.5,.4, m_texArms);

	CSgPtr<CSgSeparator> seperator = new CSgSeparator();
	CSgPtr<CSgTranslate> translate = new CSgTranslate(-.25, 0., 0.25);

	translate->SetChild(lowerArm);
	seperator->SetChild(translate);
	connection->AddChild(seperator);

	//poles
	CSgPtr<CSgOctagonalCylinder>  pole1= new CSgOctagonalCylinder(2.55f, .05f, m_TexCenter, baseMmat);
	CSgPtr<CSgSeparator> seperatorP1 = new CSgSeparator();
	CSgPtr<CSgTranslate> translateP1 = new CSgTranslate(-0.1, .7, 1.15);
	CSgPtr<CSgRotate> rotateP1_1 = new CSgRotate(-60,1,0,0);
	CSgPtr<CSgRotate> rotateP1_2 = new CSgRotate(-4,0,1,0);

	rotateP1_1->SetChild(pole1);
	rotateP1_2->SetChild(rotateP1_1);
	translateP1->SetChild(rotateP1_2);
	seperatorP1->SetChild(translateP1);
	connection->AddChild(seperatorP1);

	CSgPtr<CSgOctagonalCylinder>  pole2= new CSgOctagonalCylinder(2.55f, .05f, m_TexCenter, baseMmat);
	CSgPtr<CSgSeparator> seperatorP2 = new CSgSeparator();
	CSgPtr<CSgTranslate> translateP2 = new CSgTranslate(0.1, .7, 1.15);
	CSgPtr<CSgRotate> rotateP2_1 = new CSgRotate(-60,1,0,0);
	CSgPtr<CSgRotate> rotateP2_2 = new CSgRotate(4,0,1,0);

	rotateP2_1->SetChild(pole2);
	rotateP2_2->SetChild(rotateP2_1);
	translateP2->SetChild(rotateP2_2);
	seperatorP2->SetChild(translateP2);
	connection->AddChild(seperatorP2);

	
	CSgPtr<CSgOctagonalCylinder>  pole3= new CSgOctagonalCylinder(2.4f, .05f, m_TexCenter, baseMmat);
	CSgPtr<CSgSeparator> seperatorP3 = new CSgSeparator();
	CSgPtr<CSgTranslate> translateP3 = new CSgTranslate(0., 0.5, 1.15);
	CSgPtr<CSgRotate> rotateP3_1 = new CSgRotate(70,1,0,0);
	CSgPtr<CSgRotate> rotateP3_2 = new CSgRotate(0,0,1,0);

	rotateP3_1->SetChild(pole3);
	rotateP3_2->SetChild(rotateP3_1);
	translateP3->SetChild(rotateP3_2);
	seperatorP3->SetChild(translateP3);
	connection->AddChild(seperatorP3);

	//Add seats
	CSgPtr<CSgComposite> seat = CreateSeat();
	CSgPtr<CSgSeparator> seperatorS = new CSgSeparator();
	CSgPtr<CSgTranslate> translateS = new CSgTranslate(0., 0., 0.);

	translateS->SetChild(seat);
	seperatorS->SetChild(translateS);
	connection->AddChild(seperatorS);
	return connection;
}

CSgPtr<CSgComposite> ScramblerFactory::CreateSeat()
{
	CSgPtr<CSgComposite> comp= new CSgComposite();	
	CSgPtr<CSgComposite> chair= new CSgComposite();
	

	//Back of the chair
	CSgPtr<CSgComposite> upperBack = Arm(.1,1.,1.5,1.5, m_texSeats);

	CSgPtr<CSgSeparator> seperatorB1 = new CSgSeparator();
	CSgPtr<CSgTranslate> translateB1 = new CSgTranslate(-.35, 1.33, 2.5);
	CSgPtr<CSgRotate> rotateB1 = new CSgRotate(90.0,0,0,1);
	CSgPtr<CSgRotate> rotateB2 = new CSgRotate(90.0,1,0,0);
	CSgPtr<CSgRotate> rotateB3 = new CSgRotate(10.0,0,0,1);


	rotateB1->SetChild(upperBack);
	rotateB2->SetChild(rotateB1);
	rotateB3->SetChild(rotateB2);
	translateB1->SetChild(rotateB3);
	seperatorB1->SetChild(translateB1);
	chair->AddChild(seperatorB1);

	//Sides of the chiar
	CSgPtr<CSgComposite> sideL = Arm(.05,1.,1.,1.3, m_texSeats);

	CSgPtr<CSgSeparator> seperatorS1 = new CSgSeparator();
	CSgPtr<CSgTranslate> translateS1 = new CSgTranslate(-0.25, .33, 2.5);
	CSgPtr<CSgRotate> rotateS1 = new CSgRotate(90.0,0,0,1);
	CSgPtr<CSgRotate> rotateS2 = new CSgRotate(90.0,1,0,0);
	CSgPtr<CSgRotate> rotateS3 = new CSgRotate(180.0,1,0,0);
	CSgPtr<CSgRotate> rotateS4 = new CSgRotate(90.0,0,-1,0);

	rotateS1->SetChild(sideL);
	rotateS2->SetChild(rotateS1);
	rotateS3->SetChild(rotateS2);
	rotateS4->SetChild(rotateS3);	
	translateS1->SetChild(rotateS4);
	seperatorS1->SetChild(translateS1);
	chair->AddChild(seperatorS1);

	CSgPtr<CSgComposite> sideR = Arm(.05,1.,1.,1.3, m_texSeats);

	CSgPtr<CSgSeparator> seperatorS2 = new CSgSeparator();
	CSgPtr<CSgTranslate> translateS2 = new CSgTranslate(-0.25, .33, 4.);
	CSgPtr<CSgRotate> rotateSr1 = new CSgRotate(90.0,0,0,1);
	CSgPtr<CSgRotate> rotateSr2 = new CSgRotate(90.0,1,0,0);
	CSgPtr<CSgRotate> rotateSr3 = new CSgRotate(180.0,1,0,0);
	CSgPtr<CSgRotate> rotateSr4 = new CSgRotate(90.0,0,-1,0);

	rotateSr1->SetChild(sideR);
	rotateSr2->SetChild(rotateSr1);
	rotateSr3->SetChild(rotateSr2);
	rotateSr4->SetChild(rotateSr3);	
	translateS2->SetChild(rotateS4);
	seperatorS2->SetChild(translateS2);
	chair->AddChild(seperatorS2);

	//bottom of the chair
	CSgPtr<CSgComposite> bottom = Arm(.05,1.5,1.5,1.5, m_texSeats);

	CSgPtr<CSgSeparator> seperatorBo1 = new CSgSeparator();
	CSgPtr<CSgTranslate> translateBo1 = new CSgTranslate(-0.25, .33, 2.5);
	CSgPtr<CSgRotate> rotateBo1 = new CSgRotate(90.0,0,0,1);
	CSgPtr<CSgRotate> rotateBo2 = new CSgRotate(90.0,1,0,0);
	CSgPtr<CSgRotate> rotateBo3 = new CSgRotate(90.0,0,0,1);

	rotateBo1->SetChild(bottom);
	rotateBo2->SetChild(rotateBo1);
	rotateBo3->SetChild(rotateBo2);
	translateBo1->SetChild(rotateBo3);
	seperatorBo1->SetChild(translateBo1);
	chair->AddChild(seperatorBo1);	
	//seat in chair

	//cross bar
	CSgPtr<CSgComposite> crossBar = Arm(.1,0.5,1.5,1.5, m_texSeats);

	CSgPtr<CSgSeparator> seperatorC1 = new CSgSeparator();
	CSgPtr<CSgTranslate> translateC1 = new CSgTranslate(1., 1.33, 2.5);
	CSgPtr<CSgRotate> rotateC1 = new CSgRotate(90.0,0,0,1);
	CSgPtr<CSgRotate> rotateC2 = new CSgRotate(90.0,1,0,0);
	CSgPtr<CSgRotate> rotateC3 = new CSgRotate(-10.0,0,0,1);


	rotateC1->SetChild(crossBar);
	rotateC2->SetChild(rotateC1);
	rotateC3->SetChild(rotateC2);
	translateC1->SetChild(rotateC3);
	seperatorC1->SetChild(translateC1);
	chair->AddChild(seperatorC1);
	//step

	//foot area


	CSgPtr<CSgSeparator> seperatorC = new CSgSeparator();
	CSgPtr<CSgTranslate> translateC = new CSgTranslate(-0.25, -0.25, -0.2);

	translateC->SetChild(chair);
	seperatorC->SetChild(translateC);
	comp->AddChild(seperatorC);

	return comp;
}


CSgPtr<CSgComposite> ScramblerFactory::FootHole()
{
	CSgPtr<CSgComposite> comp= new CSgComposite();	
	CSgPtr<CSgComposite> footHole= new CSgComposite();
	     
	return NULL;
}